<?php

$user_name = $_GET['name'];
include 'dbconnect.php';
echo'<h3>ALL ANNOUNCEMENTS</h3>';
$query ="select VehicleForSaleID, ImgName from VehicleForSale";
$result = mysqli_query($mysql, $query) or die("Error: query failed\n");
//$row_cnt = mysqli_num_rows($result);	//Count the number of rows in the query result
//printf("You have %d listing(s) in the database.<BR>", $row_cnt );

while ($row = mysqli_fetch_assoc($result)) {
$id = $row["VehicleForSaleID"];
$imgName = $row["ImgName"];
printf("<a href=\"download.php?id=%d&name=%s\">%s</a></br>", $id, $user_name, $imgName);
}

echo '<a href="login.php">Log out</a>';


?>